﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>JavaScript day01</title>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
	   <script language="javascript" src="js_demo1.js" type="text/javascript"></script>
       <script language="javascript" type="text/javascript">
       		function firstMethod(){
 				alert("Hello World in script block.");
 			}
       </script>
   </head>
   <body>
        <form>
        	<h2>1.hello world</h2>
        	<input type="button" value="first button" onclick="alert('hello world.');" />
        	<input type="button" value="third button" onclick="firstMethod();" />
        	<input type="button" value="third button" onclick="secondMethod();" />
        	
        	<h2>2.判断数据类型，并计算平方</h2>
        	<input type="text" id="txtData" /><br />
        	<input type="button" value="计算平方" onclick="getSquare();" />
        	
        	<h2>3.猜数字游戏</h2>
        	请录入猜测得数字（1~20之间的整数）： <br />
        	<input id="txtNumber" type="text" onblur="guessNumber();" />
        	
        	<h2>4.控制语句：求阶乘</h2>
        	<input type="button" value="求10的阶乘" onclick="getFac();" />
        	
        	<h2>5.string对象：字符的查找与过滤</h2>
        	<input type="text" id="txtString" /><br />
        	<input type="button" value="过滤特殊字符（js）" onclick="searchStringAndReplace();" />
        	<input type="button" value="查找字符并过滤（使用正则表达式）" onclick="stringByRegex();" />
        	
        	<h2>6.Array对象：倒转，文本与数值的排序</h2>
        	<input type="text" id="txtNumbers" value="12,4,3,123,51" style="font-size:13px;" />
        	<input type="button" value="数组倒转" onclick="operateArray(1);" />
        	<input type="button" value="数组倒转(文本)" onclick="operateArray(2);" />
        	<input type="button" value="数组倒转(数值)" onclick="operateArray(3);" />
        </form>
    
   </body>
</html>



